package sise.world;

import org.apache.log4j.Logger;

import sise.world.map.WorldMap;
import sise.world.utils.MapGenerator;
import sise.world.utils.SimulationConfiguration;

public class Main {

	public static final String CONFIG_FILENAME = "src/main/resources/config.ini";
	private static final Logger logger = Logger.getLogger(Main.class);

	public static void main(String[] args) {
		logger.info("Starting application");
		Long startTime = System.currentTimeMillis();

		
		SimulationConfiguration cfg = new SimulationConfiguration(args);
		World world = new World();
		WorldMap worldMap = new WorldMap();
		worldMap.setFields(MapGenerator.generateRandomMap(cfg));
		world.setWorldMap(worldMap, cfg);

	

		for (int i = 0; i < cfg.getAmountOfTurns() && world.hasAliveAgent(); i++) {
			
			world.nextTurn();
		}


		Long endTime = System.currentTimeMillis();
		logger.info(String.format("Application is going down. Total running time: %d ms", (endTime - startTime)));
	}


}
